<template>
  <!--<el-container class="main-layout" :class="{ 'full-mode': false }">-->
  <el-container :style="defaultHeight">
    <el-main>
      <slot name="container"></slot>
    </el-main>
  </el-container>
</template>

<script>
  export default {
    name: 'MainLayout',
    components: {
    },
    data() {
      return {
        defaultHeight: {
          height: ""
        }
      };
    },
    methods: {
      //定义方法，获取高度减去头尾
      getHeight() {
        this.defaultHeight.height = window.innerHeight - 85 + "px";
      }
    },
    created() {
      //页面创建时执行一次getHeight进行赋值，顺道绑定resize事件
      window.addEventListener("resize", this.getHeight);
      this.getHeight();
      //console.log(this.defaultHeight.height)
    }

  }
</script>


<style lang="less">
  .main-layout {
    position: absolute;
    width: 75%;
    height: 80%;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    overflow: hidden;
    transition: ease 0.5s;
    border-radius: 5px;

    &.full-mode {
      width: 100%;
      height: 100%;
      border-radius: 0;
    }
  }

  @media screen and (max-width: 1000px) {
    .main-layout {
      width: 100%;
      height: 100%;
      border-radius: 0;
    }
  }
</style>
